﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeoUtils
{
    public class ViewPort
    {
       BoundRect boundary;
        LatLong focus;

        public ViewPort ( ) { }

        public ViewPort ( BoundRect boundary , LatLong focus )
        {
            this.boundary = boundary;
            this.focus = focus;
        }

        public BoundRect Boundary
        {
            get { return boundary; }
            set { boundary = value; }
        }

        public LatLong Focus
        {
            get
            {
                if (focus != null)
                {
                    return focus;
                }
                else
                {
                    return boundary.Center;
                }
            }
            set { focus = value; }
        }

        public bool IsVisible ( double longitude , double latitude )
        {
            return boundary.IsPointIn ( longitude , latitude );
        }

        public bool IsVisible ( LatLong location )
        {
            return boundary.IsPointIn ( location );
        }

        public double Distance ( double longitude , double latitude )
        {
            return Distance ( new LatLong ( longitude , latitude ) );
        }

        public double Distance ( LatLong location )
        {
            return location.Distance(Focus);
        }

      

    }
}
